package com.yijianonghu.service.wxwebsite.banner;

import java.lang.reflect.InvocationTargetException;
import java.util.Date;
import java.util.List;

import org.springframework.stereotype.Service;

import com.yijianonghu.dal.model.ProIndexAd;
import com.yijianonghu.dal.model.ProIndexAdExample;

import net.javahub.service.BaseService;

@Service
public class BannerService extends BaseService<ProIndexAd, Integer, ProIndexAdExample> {
	
	//首页轮播图的显示
	public List<ProIndexAd> getBannerList() throws ClassNotFoundException, NoSuchMethodException, SecurityException, IllegalAccessException, IllegalArgumentException, InvocationTargetException{
		ProIndexAdExample example=new ProIndexAdExample();
		Date currentDate=new Date();
		example.createCriteria()
			.andStarttimeIsNotNull()
			.andStarttimeLessThanOrEqualTo(currentDate)
			.andEndtimeIsNotNull()
			.andEndtimeGreaterThanOrEqualTo(currentDate)
			.andRemoveflagEqualTo((byte)0);	
		List<ProIndexAd> bannerList=selectListByExample(ProIndexAd.class, example);
		return bannerList;
	}
	
}
